<%--
  Created by IntelliJ IDEA.
  User: lizhun
  Date: 16/3/19
  Time: 下午4:45
  To change this template use File | Settings | File Templates.
--%>
<%@page  pageEncoding="utf-8" contentType="text/html;charset=utf-8" %>
<%@ include file="../../include/import.jsp" %>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>立即注册</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="full-screen" content="true"/>
    <meta name="screen-orientation" content="portrait"/>
    <meta name="x5-fullscreen" content="true"/>
    <meta name="360-fullscreen" content="true"/>
    <style>
        html, body {
            -ms-touch-action: none;
            background: #FFFFFF;
            padding: 0;
            border: 0;
            margin: 0;
            height: 100%;
        }
    </style>

    <!--这个标签为通过egret提供的第三方库的方式生成的 javascript 文件-->
    <!--modules_files_start-->
    <script egret="lib" src="${ctx}/libs/modules/egret/egret.min.js"></script>
    <script egret="lib" src="${ctx}/libs/modules/egret/egret.web.min.js"></script>
    <script egret="lib" src="${ctx}/libs/modules/game/game.min.js"></script>
    <script egret="lib" src="${ctx}/libs/modules/game/game.web.min.js"></script>
    <script egret="lib" src="${ctx}/libs/modules/tween/tween.min.js"></script>
    <script egret="lib" src="${ctx}/libs/modules/res/res.min.js"></script>
    <script egret="lib" src="${ctx}/libs/modules/eui/eui.min.js"></script>
    <script egret="lib" src="${ctx}/libs/modules/weixinapi/weixinapi.min.js"></script>
    <script type="text/javascript" src="${ctx}/resource/js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="${ctx}/resource/js/jquery.form.js"></script>
    <!--modules_files_end-->

    <!--这个标签为不通过egret提供的第三方库的方式使用的 javascript 文件，请将这些文件放在libs下，但不要放在modules下面。-->
    <!--other_libs_files_start-->
    <!--other_libs_files_end-->

    <!--这个标签会被替换为项目中所有的 javascript 文件-->
    <!--game_files_start-->
    <script src="${ctx}/resource/libs/main.min.cooperation.js"></script>
    <!--game_files_end-->
</head>
<body>
<div style="margin: auto;width: 100%;height: 100%;" class="egret-player"
     data-entry-class="MainScene"
     data-orientation="portrait"
     data-scale-mode="exactFit"
     data-resolution-mode="retina"
     data-frame-rate="30"
     data-content-width="640"
     data-content-height="1036"
     data-show-paint-rect="false"
     data-multi-fingered="2"
     data-show-fps="false" data-show-log="false"
     data-log-filter="" data-show-fps-style="x:0,y:0,size:30,textColor:0x00c200,bgAlpha:0.9">
</div>
<div id="gameID"> </div>
<script>

	var phoneNo="";
    //"立即注册"
    function register(phone){
        //phone 传过来的手机号码
        //进入到下一页,每次调用一次这样的接口都会跳到下一个页面
        phoneNo = phone;
        var data = "memb_phone=" + phone;
        $.ajax({
            type:'post',
            //  url:'/nativetalk/pay/notify',
            url:'/share/shareRegisterSms',
            dataType : 'json',
            data: data,
            success:function(data){
                if(data.mark=="0"){
                    egret.MainContext.instance.stage.getChildByName("_main").nextPage();
                }else{
                    alert(data.tip);
                }
            }

        });
    }
    //用户协议
    function agreement(){
        window.location.href="${ctx}/article/detail?arti_id=1";
    }
    //发送验证码
    function sendCode(){
        var data = "memb_phone=" + phoneNo;
        $.ajax({
            type:'post',
            //  url:'/nativetalk/pay/notify',
            url:'/share/shareRegisterSms',
            dataType : 'json',
            data: data,
            success:function(data){
                if(data.mark=="0"){

                }else{
                    alert(data.tip);
                }
            }

        });
    }
    //"提交验证码和密码"
    function getData(code,password){
        //code 传过来的验证码
        //password 密码
        //进入到下一页,每次调用一次这样的接口都会跳到下一个页面
		//这里可以把phoneNo当成code和password一样的参数使用传到服务端
        var data ="memb_phone=" + phoneNo + "&memb_password="+password+"&code="+code+"&invite_code=<%=request.getAttribute("invite_code")%>";
        $.ajax({
            type:'post',
            url:'/cooperation/register',
            dataType : 'json',
            data: data,
            success:function(data){
                if(data.mark=="0"){
                    egret.MainContext.instance.stage.getChildByName("_main").nextPage();
                }else{
                    alert(data.tip);
                }
            }

        });
    }
    //"下载接口"
    function download(value){
        //value 0是电脑 1是ios 2是安卓
        if(value==0){
                window.location.href="https://itunes.apple.com/cn/app/id1077827502";
        }else if(value==1){
            window.location.href="https://itunes.apple.com/cn/app/id1077827502";
        }else{
            window.location="http://app.waijiaojun.com/resource/android/waijiaojun.apk";
        }
    }

    //处理屏幕大小改变
    var resizeTimer = null;
    var doResize = function(){
        doResizeEvent(null);
        resizeTimer=null
    }
    function doResizeEvent(aspect) {
        var wid, hei, radio;//宽,高,像素比
        //获取窗口宽度
        if (window && window.innerWidth)
            wid = window.innerWidth;
        else if ((document.body) && (document.body.clientWidth))
            wid = document.body.clientWidth;
        //获取窗口高度
        if (window && window.innerHeight)
            hei = window.innerHeight;
        else if ((document.body) && (document.body.clientHeight))
            hei = document.body.clientHeight;
        //通过深入Document内部对body进行检测，获取窗口大小
        if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
            wid = document.documentElement.clientWidth;
            hei = document.documentElement.clientHeight;
        }
        //设备像素比,这里如果获取不到就自动默认为1,如果有特殊需求可以自行修改
        radio = window.devicePixelRatio || 1;
        //处理横竖屏

        console.log(aspect+"屏幕宽:"+ wid+ "|"+ "屏幕高:"+ hei+ "|"+ "设备像素比:"+ radio);
        //下面赋值给宽高适配手机浏览器
        egret.MainContext.instance.stage.getChildByName("_main").size(wid,hei);

    };
    egret.runEgret();
    window.onresize = function () {
        if(resizeTimer==null){
            resizeTimer = setTimeout(doResize, 500);
        }
    };
</script>
</body>
</html>
